# Runs the Rio test server.

# Find the project root dir.
# Abspath logic from here: http://forums.macosxhints.com/archive/index.php/t-73839.html
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
testdir=$(dirname "$abspath")
projdir=$(dirname "$testdir")

# Other convenience vars.
lib="$projdir/lib"
jetty="$lib/jetty/jetty"

# Run our script with Mozilla Rhino using the bundled jar.
java \
  -cp "$lib/rhino/js.jar:$lib/jetty/servlet-api.jar:$jetty-continuation.jar:$jetty-http.jar:$jetty-io.jar:$jetty-server.jar:$jetty-util.jar" \
  org.mozilla.javascript.tools.shell.Main \
  "$testdir/serve.js" "$projdir"
